﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Configuration;
using System.Configuration;

namespace DotNETX.CommonWcfHost
{
    public class ConfigedServiceReader
    {
        public List<string> Names { get; protected set; }

        public void Read()
        {
            ServicesSection svcs = ConfigurationManager.GetSection("system.serviceModel/services") as ServicesSection;
            foreach (ServiceElement svc in svcs.Services)
            {
                if (null == Names)
                {
                    Names = new List<string>();
                }
                string name = svc.Name;
                if (!Names.Contains(name)) Names.Add(name);
            }
        }
    }
}
